package main

import (
	"github.com/xlvector/dlog"
	"flag"
	"net/http"
	"git.oschina.net/ant180/gotesser/server"
	"git.oschina.net/ant180/gotesser/config"
)

func main() {
	fn := flag.String("f", "config_test.json", "config file")
	flag.Parse()

	conf := &config.Config{}
	err := config.ReadConfig(*fn, conf)
	if err != nil {
		dlog.Fatal("read cofig fail! %v", err)
	}
	dlog.Info("config: %#v", conf)

	server := server.NewServer(conf)

	err = http.ListenAndServe(conf.ListenAddr, server)
	if err != nil {
		dlog.Fatal("listen fail! %v", err)
	}
}